<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="TaskMapping.aspx.cs" Inherits="Admin_Workflow_TaskMapping" Title="APM - Score Range and Task Mapping" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="mapping">
        <ul id="path">
            <li><a href="../../Home.aspx">Home</a> &gt;</li>
            <li>Administration &gt;</li>
            <li>Score Range and Task Mapping</li>
        </ul>
        <h3 class="mapping">
            <span>Score Range & Task Mapping</span></h3>
        <div id="content">
            <p>
            </p>
            <table width="100%">
                <asp:Panel runat="server" ID="pnlError" Visible="false">
                    <tr>
                        <td colspan="2">
                            <asp:Label ID="lblMsg1" runat="server" Font-Bold="true">Score Range and Task Mapping Status: </asp:Label>
                            <asp:Label ID="lblMsg2" runat="server" ForeColor="red">Error</asp:Label>
                            <br />
                            <asp:Label ID="lblMsg3" runat="server" Font-Bold="true">Status Details: </asp:Label>
                            <asp:Label ID="lblMsg4" runat="server" ForeColor="red">No score ranges are entered in the system.</asp:Label>
                        </td>
                    </tr>
                </asp:Panel>
                <asp:Panel runat="server" ID="pnlGrid" Visible="true">
                    <tr>
                        <td colspan="2" style="font-weight: bold; height: 25px; vertical-align: top">
                            Assign Tasks to Score Ranges
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <table cellpadding="0" cellspacing="0" border="0">
                                <tr>
                                    <td style="width: 120px;">
                                        Select Score Range:
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="ddlScoreRange" runat="server" DataTextField="ScoreThreshold"
                                            AutoPostBack="true" Width="150" DataValueField="ScoreRangeID" AppendDataBoundItems="True"
                                            OnSelectedIndexChanged="ddlScoreRange_SelectedIndexChanged">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            Set Score Range - Task Mapping
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:GridView ID="gridTaskMappingDisabled" runat="server" AllowPaging="True" AllowSorting="True"
                                OnRowDeleted="gridTaskMappingDisabled_RowDeleted" DataSourceID="obdsTaskMappingDisabled"
                                AutoGenerateColumns="False" AutoGenerateEditButton="False" CssClass="table" DataKeyNames="TaskID"
                                EmptyDataText="No Task(s) found." OnRowDeleting="gridTaskMappingDisabled_RowDeleting"
                                PageSize="10" ToolTip="This table shows all the tasks that can be mapped to the selected Score Range.">
                                <AlternatingRowStyle CssClass="alternate" />
                                <PagerSettings Position="TopAndBottom" />
                                <PagerStyle CssClass="pages" />
                                <EmptyDataRowStyle BackColor="#C4D7D6" BorderStyle="none" />
                                <HeaderStyle HorizontalAlign="Left" />
                                <Columns>
                                    <asp:CommandField ShowDeleteButton="true" DeleteText="Add" HeaderText="Select" ButtonType="link"
                                        HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                                        <ItemStyle Width="70px" Wrap="False" />
                                    </asp:CommandField>
                                    <asp:TemplateField HeaderText="Life Cycle Stage Name" SortExpression="LifeCycleName">
                                        <ItemTemplate>
                                            <%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("LifeCycleName").ToString()) %>
                                        </ItemTemplate>
                                        <ItemStyle Width="150px" Wrap="False" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Task Name" SortExpression="TaskName">
                                        <ItemTemplate>
                                            <%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("TaskName").ToString()) %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <RowStyle HorizontalAlign="Left" />
                            </asp:GridView>
                            <asp:ObjectDataSource ID="obdsTaskMappingDisabled" OnSelecting="gridTaskMappingDisabled_Selecting"
                                runat="server" TypeName="Microsoft.AceEngineering.SPM.SPMBusinessLayer.ScoreRangeTaskBL"
                                DeleteMethod="Delete" SelectMethod="GetDisabledScoreRangeTask" OldValuesParameterFormatString="{0}"
                                SortParameterName="dir">
                                <SelectParameters>
                                    <asp:Parameter Name="scoreRangeID" Type="int32" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            Existing Score Range - Task Mapping
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:GridView ID="gridTaskMappingEnabled" runat="server" AllowPaging="True" AllowSorting="True"
                                OnRowDeleted="gridTaskMappingEnabled_RowDeleted" DataSourceID="obdsTaskMappingEnabled"
                                AutoGenerateColumns="False" AutoGenerateEditButton="False" CssClass="table" DataKeyNames="TaskID"
                                OnRowDataBound="gridTaskMappingEnabled_RowDataBound" EmptyDataText="No Task(s) found."
                                OnRowDeleting="gridTaskMappingEnabled_RowDeleting" PageSize="10" ToolTip="This table shows all the tasks that are already mapped to the selected Score Range.">
                                <AlternatingRowStyle CssClass="alternate" />
                                <PagerSettings Position="TopAndBottom" />
                                <PagerStyle CssClass="pages" />
                                <EmptyDataRowStyle BackColor="#C4D7D6" BorderStyle="none" />
                                <HeaderStyle HorizontalAlign="Left" />
                                <Columns>
                                    <asp:CommandField ShowDeleteButton="true" DeleteText="Remove" HeaderText="Select"
                                        ButtonType="link" HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                                        <ItemStyle Width="70px" Wrap="False" />
                                    </asp:CommandField>
                                    <asp:TemplateField HeaderText="Life Cycle Stage Name" SortExpression="LifeCycleName">
                                        <ItemTemplate>
                                            <%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("LifeCycleName").ToString()) %>
                                        </ItemTemplate>
                                        <ItemStyle Width="150px" Wrap="False" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Task Name" SortExpression="TaskName">
                                        <ItemTemplate>
                                            <%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("TaskName").ToString()) %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <RowStyle HorizontalAlign="Left" />
                            </asp:GridView>
                            <asp:ObjectDataSource ID="obdsTaskMappingEnabled" OnSelecting="gridTaskMappingEnabled_Selecting"
                                runat="server" TypeName="Microsoft.AceEngineering.SPM.SPMBusinessLayer.ScoreRangeTaskBL"
                                DeleteMethod="Delete" SelectMethod="GetEnabledScoreRangeTask" OldValuesParameterFormatString="{0}"
                                SortParameterName="dir">
                                <SelectParameters>
                                    <asp:Parameter Name="scoreRangeID" Type="int32" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                        </td>
                    </tr>
                </asp:Panel>
            </table>
        </div>
    </div>
</asp:Content>
